using System;
using System.Collections;
using System.Xml;
using InfoJetSoft.Service.Util;

namespace InfoJetSoft.Service.Util
{
	/// <summary>
	/// Summary description for SimpleNamespaceResolver.
	/// </summary>
	class SimpleNamespaceResolver : XmlNamespaceManager
	{

		private Hashtable prefixTable = null;
		private Hashtable uriTable = null;

		public SimpleNamespaceResolver(XmlNameTable nameTable):base(nameTable)
		{
			this.prefixTable = new Hashtable();
			this.uriTable = new Hashtable();
		}

		public void SetNamespace( string prefix, string uri )
		{
			HashtableUtil.addSafety( this.prefixTable, prefix, uri );
			HashtableUtil.addSafety( this.uriTable, uri, prefix );
			this.AddNamespace( prefix, uri );
		}

		public string GetPrefix( string uri )
		{
			return (string) this.uriTable[ uri ];
		}

		public string GetURI( string prefix )
		{
			return (string) this.prefixTable[ prefix ];
		}

	}
}
